package com.ruoyi.web.controller.system;

import java.util.List;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.system.domain.WcsUsers;
import com.ruoyi.system.service.IWcsUsersService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 称重分拣参数Controller
 * 
 * @author ZYT
 * @date 2020-12-06
 */
@RestController
@RequestMapping("/system/WcsUsers")
public class WcsUsersController extends BaseController
{
    @Autowired
    private IWcsUsersService wcsUsersService;

    /**
     * 查询称重分拣参数列表
     */
    @PreAuthorize("@ss.hasPermi('system:WcsUsers:list')")
    @GetMapping("/list")
    public TableDataInfo list(WcsUsers wcsUsers)
    {
        startPage();
        List<WcsUsers> list = wcsUsersService.selectWcsUsersList(wcsUsers);
        return getDataTable(list);
    }

    /**
     * 导出称重分拣参数列表
     */
    @PreAuthorize("@ss.hasPermi('system:WcsUsers:export')")
    @Log(title = "称重分拣参数", businessType = BusinessType.EXPORT)
    @GetMapping("/export")
    public AjaxResult export(WcsUsers wcsUsers)
    {
        List<WcsUsers> list = wcsUsersService.selectWcsUsersList(wcsUsers);
        ExcelUtil<WcsUsers> util = new ExcelUtil<WcsUsers>(WcsUsers.class);
        return util.exportExcel(list, "WcsUsers");
    }

    /**
     * 获取称重分拣参数详细信息
     */
    @PreAuthorize("@ss.hasPermi('system:WcsUsers:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return AjaxResult.success(wcsUsersService.selectWcsUsersById(id));
    }

    /**
     * 新增称重分拣参数
     */
    @PreAuthorize("@ss.hasPermi('system:WcsUsers:add')")
    @Log(title = "称重分拣参数", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody WcsUsers wcsUsers)
    {
        return toAjax(wcsUsersService.insertWcsUsers(wcsUsers));
    }

    /**
     * 修改称重分拣参数
     */
    @PreAuthorize("@ss.hasPermi('system:WcsUsers:edit')")
    @Log(title = "称重分拣参数", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody WcsUsers wcsUsers)
    {
        return toAjax(wcsUsersService.updateWcsUsers(wcsUsers));
    }

    /**
     * 删除称重分拣参数
     */
    @PreAuthorize("@ss.hasPermi('system:WcsUsers:remove')")
    @Log(title = "称重分拣参数", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(wcsUsersService.deleteWcsUsersByIds(ids));
    }
}
